home *** CD-ROM | disk | FTP | other *** search
Wrap
SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) NNNNAAAAMMMMEEEE SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx - The SgSpringBox widget class SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<SSSSggggmmmm////SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx....hhhh>>>> VVVVEEEERRRRSSSSIIIIOOOONNNN This page documents the version of Sgm that accompanies Motif 1.2. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN SgSpringBox is a container widget with no input semantics of its own. It arranges its children in a single row or column based on a set of spring constraints assigned to each child. The SgSpringBox widget allows layouts similar to those supported by the XmForm widget, but are usually easier to set up. It is also possible to create some layouts that cannot be achieved with the XmForm widget. For example, centering a column of widgets is very easy to do with the SgSpringBox widget, but nearly impossible using the XmForm. Each child of an SgSpringBox widget has 6 constraints associated with it. First, each child has a "springyness" in both the vertical and horizontal direction that determines how much the child may be resized in each direction. The resources XmNverticalSpring and XmNhorizontalSpring control the degree of "springyness" in each child. A value of zero means the child cannot be resized in that direction. For non-zero values, the values are compared to the values of other springs in the overall system to determine the proportional effects of any resizing. The default value of both resources is zero. Each child also has a spring between its left, right, top, and bottom sides and whatever boundary it is adjacent to. By default, the value of each of these springs is 50. A value of zero means that the SgSpringBox widget cannot add additional space adjacent to that part of a widget. Larger values are considered in relation to all other spring values in the system. The behavior of the widget is best seen by example. The following code places two widget in a single column. With the default resource settings, this results in both chidlren being centered in the parent, one above the other. void createCenteredWidgets(Widget parent) { Arg args[2]; Page 1 (printed 10/3/02) SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) Widget springbox, child1, child2; XtSetArg(args[0], XmNorientation, XmVERTICAL); springbox = SgCreateSpringBox( parent, "column", args, 1 ); child1 = XmCreatePushButton ( box, "child1", NULL, 0 ); child2 = XmCreatePushButton ( box, "child2", NULL, 0 ); XtManageChild(child1); XtManageChild(child2); XtManageChild(springbox); } This example creates two widgets in a horizontal row. As the row is resized, the widget gravitates to the left and right sides of the row. The leftmost child also hangs from the top of its parent, while the rightmost widget gravitates to the bottom of its parent. void createCenteredWidgets(Widget parent) { Arg args[5]; int n; Widget springbox, child1, child2; n = 0; XtSetArg(args[n], XmNorientation, XmCOLUMN);n++ springbox = SgCreateSpringBox( parent, "column", args, 1 ); n = 0; XtSetArg(args[n], XmNrightSpring, 0);n++ XtSetArg(args[n], XmNleftSpring, 100);n++ XtSetArg(args[n], XmNbottomSpring, 0);n++ XtSetArg(args[n], XmNtopSpring, 100);n++ child1 = XmCreatePushButton ( box, "child1", args, n); n = 0; XtSetArg(args[n], XmNrightSpring, 100);n++ XtSetArg(args[n], XmNleftSpring, 0);n++ XtSetArg(args[n], XmNbottomSpring, 100);n++ XtSetArg(args[n], XmNtopSpring, 0);n++ child2 = XmCreatePushButton ( box, "child2", args, n); XtManageChild(child1); XtManageChild(child2); XtManageChild(springbox); } Following are some important considerations in using a Page 2 (printed 10/3/02) SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) SgSpringBox: Unmapping a child has no effect on the SgSpringBox except that the child is not mapped. CCCCllllaaaasssssssseeeessss SgSpringBox inherits behavior and resources from CCCCoooorrrreeee, CCCCoooommmmppppoooossssiiiitttteeee, CCCCoooonnnnssssttttrrrraaaaiiiinnnntttt, XXXXmmmmMMMMaaaannnnaaaaggggeeeerrrr, and XXXXmmmmBBBBuuuulllllllleeeettttiiiinnnnBBBBooooaaaarrrrdddd classes. The class pointer is ssssggggSSSSpppprrrriiiinnnnggggBBBBooooxxxxWWWWiiiiddddggggeeeettttCCCCllllaaaassssssss. The class name is SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx. NNNNeeeewwww RRRReeeessssoooouuuurrrrcccceeeessss The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XXXXmmmmNNNN or XXXXmmmmCCCC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the XXXXmmmm prefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words). The codes in the access column indicate if the given resource can be set at creation time (C), set by using XXXXttttSSSSeeeettttVVVVaaaalllluuuueeeessss (S), retrieved by using XXXXttttGGGGeeeettttVVVVaaaalllluuuueeeessss (G), or is not applicable (N/A). SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss ______________________________________________________________ XmNorientation XmCOrientation int XmHORIZONTAL CG SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx CCCCoooonnnnssssttttrrrraaaaiiiinnnntttt RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss _________________________________________________________ XmNleftSpring XmCSpring int 50 CSG XmNrightSpring XmCSpring int 50 CSG XmNtopSpring XmCSpring int 50 CSG XmNbottomSpring XmCSpring int 50 CSG XmNverticalSpring XmCSpring int 0 CSG XmNhorizontalSpring XmCSpring int 0 CSG XXXXmmmmNNNNlllleeeeffffttttSSSSpppprrrriiiinnnngggg Determines the stretchability of the space adjacent to the left side of the widget. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XXXXmmmmNNNNrrrriiiigggghhhhttttSSSSpppprrrriiiinnnngggg Determines the stretchability of the space adjacent to the Page 3 (printed 10/3/02) SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) right side of the widget. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XXXXmmmmNNNNttttooooppppSSSSpppprrrriiiinnnngggg Determines the stretchability of the space adjacent to the top side of the widget. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XXXXmmmmNNNNbbbboooottttttttoooommmmSSSSpppprrrriiiinnnngggg Determines the stretchability of the space adjacent to the bottom side of the widget. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XXXXmmmmNNNNvvvveeeerrrrttttiiiiccccaaaallllSSSSpppprrrriiiinnnngggg Determines the stretchability of the widget in the vertical direction. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XXXXmmmmNNNNhhhhoooorrrriiiizzzzoooonnnnttttaaaallllSSSSpppprrrriiiinnnngggg Determines the stretchability of the widget in the horizontal direction. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. IIIInnnnhhhheeeerrrriiiitttteeeedddd RRRReeeessssoooouuuurrrrcccceeeessss SgSpringBox inherits behavior and resources from the following superclasses. For a complete description of each resource, refer to the man page for that superclass. XXXXmmmmBBBBuuuulllllllleeeettttiiiinnnnBBBBooooaaaarrrrdddd RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss _________________________________________________________________________________ XmNallowOverlap XmCAllowOverlap Boolean True CSG XmNautoUnmanage XmCAutoUnmanage Boolean True CG XmNbuttonFontList XmCButtonFontList XmFontList dynamic CSG XmNcancelButton XmCWidget Widget NULL SG XmNdefaultButton XmCWidget Widget NULL SG XmNdefaultPosition XmCDefaultPosition Boolean True CSG XmNdialogStyle XmCDialogStyle unsigned char dynamic CSG XmNdialogTitle XmCDialogTitle XmString NULL CSG XmNfocusCallback XmCCallback XtCallbackList NULL C XmNlabelFontList XmCLabelFontList XmFontList dynamic CSG XmNmapCallback XmCCallback XtCallbackList NULL C XmNmarginHeight XmCMarginHeight Dimension 0 CSG XmNmarginWidth XmCMarginWidth Dimension 0 CSG XmNnoResize XmCNoResize Boolean False CSG Page 4 (printed 10/3/02) SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) XmNresizePolicy XmCResizePolicy unsigned char XmRESIZE_ANY CSG XmNshadowType XmCShadowType unsigned char XmSHADOW_OUT CSG XmNtextFontList XmCTextFontList XmFontList dynamic CSG XmNtextTranslations XmCTranslations XtTranslations NULL C XmNunmapCallback XmCCallback XtCallbackList NULL C XXXXmmmmMMMMaaaannnnaaaaggggeeeerrrr RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss _______________________________________________________________________________________________________ XmNbottomShadowColor XmCBottomShadowColor Pixel dynamic CSG XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG XmNforeground XmCForeground Pixel dynamic CSG XmNhelpCallback XmCCallback XtCallbackList NULL C XmNhighlightColor XmCHighlightColor Pixel dynamic CSG XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG XmNinitialFocus XmCInitialFocus Widget dynamic CSG XmNnavigationType XmCNavigationType XmNavigationType XmTAB_GROUP CSG XmNshadowThickness XmCShadowThickness Dimension dynamic CSG XmNstringDirection XmCStringDirection XmStringDirection dynamic CG XmNtopShadowColor XmCBackgroundTopShadowColor Pixel dynamic CSG XmNtopShadowPixmap XmCTopShadowPixmap Pixmap dynamic CSG XmNtraversalOn XmCTraversalOn Boolean True CSG XmNunitType XmCUnitType unsigned char dynamic CSG XmNuserData XmCUserData Pointer NULL CSG CCCCoooommmmppppoooossssiiiitttteeee RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss ______________________________________________________________________ XmNchildren XmCReadOnly WidgetList NULL G XmNinsertPosition XmCInsertPosition XtOrderProc NULL CSG XmNnumChildren XmCReadOnly Cardinal 0 G CCCCoooorrrreeee RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss ______________________________________________________________________________________________________________ XmNaccelerators XmCAccelerators XtAccelerators dynamic N/A XmNancestorSensitive XmCSensitive Boolean dynamic G XmNbackground XmCBackground Pixel dynamic CSG XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG XmNborderColor XmCBorderColor Pixel XtDefaultForeground CSG XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG XmNborderWidth XmCBorderWidth Dimension 0 CSG XmNcolormap XmCColormap Colormap dynamic CG XmNdepth XmCDepth int dynamic CG XmNdestroyCallback XmCCallback XtCallbackList NULL C XmNheight XmCHeight Dimension dynamic CSG XmNinitialResourcesPersistent XmCInitialResourcesPersistent Boolean True C Page 5 (printed 10/3/02) SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV SSSSggggSSSSpppprrrriiiinnnnggggBBBBooooxxxx((((3333XXXX)))) XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG XmNscreen XmCScreen Screen * dynamic CG XmNsensitive XmCSensitive Boolean True CSG XmNtranslations XmCTranslations XtTranslations dynamic CSG XmNwidth XmCWidth Dimension dynamic CSG XmNx XmCPosition Position 0 CSG XmNy XmCPosition Position 0 CSG TTTTrrrraaaannnnssssllllaaaattttiiiioooonnnnssss qSgSpringBox inherits translations from XmBulletinBoard. RRRREEEELLLLAAAATTTTEEEEDDDD IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN CCCCoooommmmppppoooossssiiiitttteeee((((3333XXXX)))), CCCCoooonnnnssssttttrrrraaaaiiiinnnntttt((((3333XXXX)))), CCCCoooorrrreeee((((3333XXXX)))), XXXXmmmmBBBBuuuulllllllleeeettttiiiinnnnBBBBooooaaaarrrrdddd((((3333XXXX)))), SSSSggggCCCCrrrreeeeaaaatttteeeeGGGGrrrriiiidddd, SSSSggggCCCCrrrreeeeaaaatttteeeeGGGGrrrriiiiddddDDDDiiiiaaaalllloooogggg((((3333XXXX)))), and XXXXmmmmMMMMaaaannnnaaaaggggeeeerrrr((((3333XXXX)))). Page 6 (printed 10/3/02)